package business;

import java.util.ArrayList;

import bean.Article;
import database.DB_Handler;

/**
 * Business logic handler for all article functions which have to be passed to the database layer 
 * @author kaeufler.marcel
 */
public class BL_Article {

	/**
	 * @return returns an ArrayList with all articles from the database
	 */
	public ArrayList<Article> getAll(){
		return DB_Handler.getInstance().getAllArticles();
	}
	
	/**
	 * Adds an article to the database
	 * @param article article that should be added to the database
	 * @return Returns the same article but with it's new id which is created by the database
	 */
	public Article add(Article article){
		return DB_Handler.getInstance().addArticle(article);
	}
	
	/**
	 * Updates an existing article in the database
	 * @param article The article that should be updated in the database
	 */
	public void update(Article article){
		DB_Handler.getInstance().updateArticle(article);
	}
}
